package com.wetao.lib_common.bean.vo;

import android.os.Parcel;
import android.os.Parcelable;

public class AnswerUiData implements Parcelable{
    private boolean isListen;// 1-听力， 0-问题
    private AnswerUiDataListen uiListen;
    private AnswerUiDataQuestion uiQuestion;

    public AnswerUiData() {

    }

    public AnswerUiData(boolean isListen, AnswerUiDataListen uiListen, AnswerUiDataQuestion uiQuestion) {
        this.isListen = isListen;
        this.uiListen = uiListen;
        this.uiQuestion = uiQuestion;
    }

    public static Creator<AnswerUiData> getCREATOR() {
        return CREATOR;
    }

    public static final Creator<AnswerUiData> CREATOR = new Creator<AnswerUiData>() {
        @Override
        public AnswerUiData createFromParcel(Parcel in) {
            return new AnswerUiData(in);
        }

        @Override
        public AnswerUiData[] newArray(int size) {
            return new AnswerUiData[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    protected AnswerUiData(Parcel in) {
        readFromParcel(in);
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeByte((byte)(isListen ?1:0));
        out.writeParcelable(uiListen, flags);
        out.writeParcelable(uiQuestion, flags);
    }

    private void readFromParcel(Parcel in) {
        isListen =in.readByte()!=0;
        uiListen = in.readParcelable(AnswerUiDataListen.class.getClassLoader());
        uiQuestion = in.readParcelable(AnswerUiDataListen.class.getClassLoader());
    }

    public boolean isListen() {
        return isListen;
    }

    public void setListen(boolean listen) {
        isListen = listen;
    }

    public AnswerUiDataListen getUiListen() {
        return uiListen;
    }

    public void setUiListen(AnswerUiDataListen uiListen) {
        this.uiListen = uiListen;
    }

    public AnswerUiDataQuestion getUiQuestion() {
        return uiQuestion;
    }

    public void setUiQuestion(AnswerUiDataQuestion uiQuestion) {
        this.uiQuestion = uiQuestion;
    }

    @Override
    public String toString() {
        return "isListen = " + isListen
                + ", uiListen = " +  uiListen
                + ", uiQuestion =" + uiQuestion
                ;
    }
}
